package test;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

public class Main {

	public static final void main(String[] args) {
		String dateString = "2008-06-23T09:54:10+01:00";
		System.out.println(new Main().convertLongDateString(dateString));
	}
	
	private String convertLongDateString(String dateString) {
		String dateFormatted;
		try {
			SimpleDateFormat originalFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
			SimpleDateFormat goalFormat = new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss");
			//This will enable time extraction/addition regarding to time zones
			goalFormat.setTimeZone(TimeZone.getTimeZone("GMT+00:00"));			
			// This removes ':' from zone time
			String dateNormalized = dateString.substring(0, 22) + dateString.substring(23);
			Date date = originalFormat.parse(dateNormalized);
			dateFormatted = goalFormat.format(date);
		} catch (ParseException e) {
			dateFormatted = null;
		}
		return dateFormatted;
	}

    public void test() {
        System.out.println("Test method called.");
    }
}
